<?php

// +----------------------------------------------------------------------
// | EasyAdmin
// +----------------------------------------------------------------------
// | PHP交流群: 763822524
// +----------------------------------------------------------------------
// | 开源协议  https://mit-license.org 
// +----------------------------------------------------------------------
// | github开源项目：https://github.com/zhongshaofa/EasyAdmin
// +----------------------------------------------------------------------

namespace app\common\command;


use app\admin\model\DictData;
use app\admin\service\ExcelService;
use EasyAdmin\console\CliEcho;
use EasyAdmin\tool\CommonTool;
use EasyAdmin\upload\driver\alioss\Oss;
use think\console\Command;
use think\console\Input;
use think\console\input\Option;
use think\console\Output;

class Platform extends Command
{

    protected function configure()
    {
        $this->setName('Platform')
            ->setDescription('平台名称导入');
    }

    protected function execute(Input $input, Output $output)
    {
        $file=root_path('public').'平台名称.xlsx';
        $data=ExcelService::import($file);
        unset($data[0]);
        // die(var_dump($data));

        $list=[];
        foreach ($data as $datum) {
            $list[]=[
              'pid'=>3,
              'status'=>0,
              'title'=>$datum[1],
              'value'=>$datum[0],
            ];
        }

        $model=new DictData();
        $model->saveAll($list);
        $output->writeln("完成" . date('Y-m-d H:i:s'));
    }

}